<template>
	<view>
		<simple-toolbar :title="$t('pool.poolInfo.title_list')">
			<!-- <view>
				<el-button @click="navToAdd" type="primary" plain>{{ $t('pool.poolInfo.newPoolInfo') }}</el-button>
			</view> -->
		</simple-toolbar>

		<view class="pad-base table">
			<el-table :data="listData" style="width: 100%">
				<el-table-column align='center' prop="pool_name" :label="$t('pool.poolInfo.pool_name')"></el-table-column>
				<el-table-column align='center' prop="public_key" :label="$t('pool.poolInfo.public_key')"></el-table-column>
				<el-table-column align='center' prop="total_tib" :label="$t('pool.poolInfo.total_tib')"></el-table-column>
				<el-table-column align='center' prop="current_tib" :label="$t('pool.poolInfo.current_tib')"></el-table-column>
				<el-table-column align='center' :label="$t('global.action.opt')" width="80">
					<template slot-scope="scope">
						<el-button @click="navToEdit(scope.row)" type="text" size="small">
							{{ $t('global.action.modify') }}
						</el-button>
					</template>
				</el-table-column>
			</el-table>
		</view>
	</view>
</template>

<script>
	import {
		getPoolInfoList
	} from "../../../js_sdk/uni-admin/assetPool.js"

	export default {
		data() {
			return {
				listData: []
			}
		},
		methods: {
			navToEdit(row) {
				uni.navigateTo({
					url: `./pool-form?&data=${encodeURIComponent(JSON.stringify(row))}`
				})
			},
			navToAdd() {
				uni.navigateTo({
					url: `./pool-form`
				})
			},
			async loadData() {
				let res = await getPoolInfoList()
				this.listData = res.data
			}
		},
		onShow() {
			this.loadData()
		}
	}
</script>

<style>

</style>
